home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-17 | 12.5 KB | 345 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: 4D.vu
- #
- # Contains: Quick look test script for 4th Dimension version 2.2.3
- #
- # Written by: Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
- #
- # Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # <1.0.6> 9/20/93 KTA Redefine gCustomRetrievedDoc to incorporate teh wildcard
- # character.
- # <1.0.5> 9/14/93 KTA Define gCustomRetrievedDoc prior to calling SaveAs().
- # <1.0.2> 6/16/93 NAGA Renaming InitGlobals(ScriptLevel)()to InitGlobals(ScriptLevel)()
- # <1+> 5/25/93 NAGA Adding header and porting old files to follow new standards
- #
- # ****************************************************************************
- #
-
-
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "Output.Lib", "DoTasks.Lib","UserInterface.Lib","Draw.Lib", "StandardFile.Lib", "Da.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
-
-
- #########################################################################
- ######## Application Specific Tasks
- #########################################################################
-
- #########################################################################
- # InitAppGlobals()
- #========================================================================
- # Author: ML
- # Description: Sets up the tool palette for 4D. This task
- # must be called first.
- # Parameters: None
- # Returns: Nothing
- # Examples: InitAppGlobals()
- #========================================================================
- # History:
- #
- ########################################################################
- task InitAppGlobals()
- begin
- global gApptitle;
- logstr("setting up {gApptitle}'s tool globals");
- global kClick, kDrag, kMultiDrag, kMultiClickDrag, kMultiClick;
- global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
- global kDrawPaletteNum := 1;
-
- global gPaletteList := {
- { #### Start Palette #1 - Draw
- {0,20,44,260,0}, # Location of tab palette relative to the window
- kPalDocWind, # Palette type
- {2,11}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {22,22}, # Offset between tools {h,v}
- 0, # Not used at this time
- 0 # Not used at this time
- } #### End Palette #1
- };
-
- ### Palette Elements:= Tool#, Pal#, ToolName, ToolType, DblClktoEnd SetAttributes
- global LineTool := { 1, 1, "Line", kDrag, 0, {0} };
- global SelectTool := { 2, 1, "Select", kClick, 0, {0} };
- global CircleTool := { 3, 1, "Circle", kDrag, 0, {0} };
- global TextTool := { 4, 1, "Text", kDrag, 0, {0} };
- global RoundRectTool := { 5, 1, "Round Rect", kDrag, 0, {0} };
- global RectangleTool := { 6, 1, "Rectangle", kDrag, 0, {0} };
- global AlignRightTool := { 11, 1, "Align Right", 0, 0, {0} };
- global AlignLeftTool := { 12, 1, "Align Left", 0, 0, {0} };
- global AlignVCenterTool := { 13, 1, "Align V. Center", 0, 0, {0} };
- global AlignHCenterTool := { 14, 1, "Align H. Center", 0, 0, {0} };
- global AlignBottomTool := { 15, 1, "Align Bottom", 0, 0, {0} };
- global AlignTopTool := { 16, 1, "Align Top", 0, 0, {0} };
- global SendToFrontTool := { 17, 1, "Send To Front", 0, 0, {0} };
- global SendToBackTool := { 18, 1, "Send To Back", 0, 0, {0} };
-
- global DrawToolList:={ LineTool,
- SelectTool,
- CircleTool,
- TextTool,
- RoundRectTool,
- RectangleTool,
- AlignRightTool,
- AlignLeftTool,
- AlignVCenterTool,
- AlignHCenterTool,
- AlignBottomTool,
- AlignTopTool,
- SendToFrontTool,
- SendToBackTool
- };
-
- global gToolList:= DrawToolList;
-
- ### Set DoWindows to skip scrolling, scroll bars not recognized
- global gDoWindowList:= {1,0,1,1};
-
- logstr("setting up {gApptitle}'s's font globals");
-
- ### font characteristic lists
- global gFontSizeList := {'9','10','12','14','18','24','36'};
- global gFontStyleList := {'Bold','Italic','Outline', 'Underline','Shadow'};
-
- ### Name of the Plain (style) menu item ####
- global gPlainStyle := "Plain"; # Plain-Style menu item
-
- ### How to get to the next line
- global gNextLineMethod := 1;
- ### 1 - ReturnKey, 2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
-
- ### Does moving to the next line clear all font info
- global gNextLineClearsFontSettings := 0;
- global gNumRandomFontTests := 1; # only one iteration since we draw only
- # one text block
-
- end; #InitAppGlobals
-
- #########################################################################
- # NewField()
- #========================================================================
- # Author: JLM (x45604)
- # Description: Inserts new fields into database file
- # Parameters: Nothing
- # Returns: Nothing
- # Examples: NewField();
- # Assumptions: None
- # Applications: 4th Dimension
- #========================================================================
- # History:
- #
- #########################################################################
- task NewField(FieldName) begin
- logstr("Creating a new field called '{FieldName}'");
- selectMenuItem("New Field", "Structure");
- x := match [button t:'OK']!;
- if x begin
- TypeStr(FieldName);
- selectButton('OK');
- end;
- else begin
- LogStr("!@#$% No Save Button ");
- end;
- end;
-
-
- #########################################################################
- # NewLayout()
- #========================================================================
- # Author: KTA (x45604)
- # Description: Sets up a new Layout
- # Parameters: Nothing
- # Returns: Nothing
- # Examples: NewLayout();
- # Assumptions: None
- # Applications: 4th Dimension
- #========================================================================
- # History:
- #
- #########################################################################
- task NewLayout()
- begin
- selectMenuItem("Layout", "Design"); #create layout
- selectButton('New');
- TypeStr("ShimmaLayout");
- selectButton('OK');
- LogStr("Created new layout",3);
- end;
-
- #########################################################################
- # EnterRecord()
- #========================================================================
- # Author: KTA (x45604)
- # Description: Enters Records
- # Parameters: Nothing
- # Returns: Nothing
- # Examples: EnterRecord();
- # Assumptions: None
- # Applications: 4th Dimension
- #========================================================================
- # History:
- #
- #########################################################################
- task EnterRecord()
- begin
- selectMenuItem("New Record", "Enter");
- DataList1 := {'Freehand','Wingz','PageMaker'};
- DataList2 := {'Studio8','Excel','X-Quark'};
- DataListControl :={DataList1, DataList2};
- For each DataList in DataListControl
- begin
- TypeList(DataList,1,1);
-
- selectMenuItem("New Record", "Enter");
- SpecialKey(returnKey, 'Return Key'); #To Select the Default-Save
- end;
-
- LogStr("Entered two new records",3);
- end;
-
- #########################################################################
- # NewDataStructure()
- #========================================================================
- # Author: KTA (x45604)
- # Description: Sets up new Database structure
- # Parameters: Nothing
- # Returns: Nothing
- # Examples: NewDataStructure(1);
- # Assumptions: None
- # Applications: 4th Dimension
- #========================================================================
- # History:
- #
- #########################################################################
- task NewDataStructure()
- begin
-
- LogStr("Creating a new database structure",3);
- selectMenuItem("Rename File", "Structure"); # Rename file to Software
- TypeStr("Software");
- SpecialKey(returnKey, 'Return Key');
- wait(2);
- NewField("Graphics"); # Enter fields into file
- NewField("Spreadsheets");
- NewField("DTP");
- end;
-
- #########################################################################
- # 4DScroll()
- #========================================================================
- # Author: ML
- # Description: Scroll vertically and horizontally, and return
- # Parameters: None
- # Returns: Nothing
- # Examples: FourDScroll();
- # Assumptions: None
- # Applications: 4D
- #========================================================================
- # History:
- #
- #########################################################################
- task FourDScroll()
- begin
- match[window o:1 s:document c:true z:true g:true r:?ScreenDim];
- WindowRight:= ScreenDim[3];
- WindowBottom:= ScreenDim[4];
- HRightScrollButton:= (WindowRight-10);
- VRightScrollButtonBegin:= 65;
- VRightScrollButtonEnd:= (WindowBottom-40);
- VBottomScrollButton:= (WindowBottom-10);
- HBottomScrollButtonBegin:= 39;
- HBottomScrollButtonEnd:= WindowRight-40;
-
- LogStr("Scroll the window vertically using absolute coordinates");
- MoveMouse(HRightScrollButton,VRightScrollButtonBegin);
- MoveMouse(HRightScrollButton,VRightScrollButtonEnd,,1);
-
- LogStr("Scroll the window horizontally using absolute coordinates");
- MoveMouse(HBottomScrollButtonBegin,VBottomScrollButton);
- MoveMouse(HBottomScrollButtonEnd,VBottomScrollButton,,1);
-
- LogStr("Scroll back to original vertical position");
- MoveMouse(HRightScrollButton,VRightScrollButtonEnd);
- MoveMouse(HRightScrollButton,VRightScrollButtonBegin,,1);
-
- LogStr("Scroll back to original horizontal position");
- MoveMouse(HBottomScrollButtonEnd,VBottomScrollButton);
- MoveMouse(HBottomScrollButtonBegin,VBottomScrollButton,,1);
- end;
-
- ################################################################################
- #################### Main script ####################
- ################################################################################
- script FourD (ScriptLevel:= -1)
- begin
- InitGlobals(ScriptLevel);
- InitDraw();
- InitFonts();
- global gAppTitle := '4th DIMENSION'; # Don't use full name because it makes
- global gAppVersion := '2'; # gFileName too long for Standard File
- SuiteStart('4D.vu'); # begin a new test suite
- if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
- begin
- global gFileName := "@!@-{gBuildVers}-'4th DIM'"; # This is used in NameOK when saving files
- # gAppTitle not used because it makes gFileName too long for Standard File
- InitAppGlobals(); # Can't use tools - see note below
- (*
- *)
- DoSetUpApp(,-1,0,'New',,,0); # select "New" at launch
-
- global gCustomRetrievedDoc := [window t:/Structure for≈/ o:1 s:document c:false z:true g:true];
-
- SaveAs(gFileName,0); # name database
-
- NewDataStructure(); # Sets up new Database structure
-
- OpenFile(global gLastSavedFile,,{global gLastSavedFile},1); # open folder first time
-
- NewLayout(); # New Layout
-
- Scrapbook(global kScrapPICT); # Paste a Graphic from Scrapbook
-
- SelectMenuItem ('Save Layout','File'); # save layout
-
- DoWindow(); # test windows
-
- FourDScroll(); # ScrollWindow() doesn't work in 4D
- Scrapbook(global kScrapPICT); # Paste a Graphic from Scrapbook
-
- Revert(); # gets rid of second scrap pict
-
- CloseWindow(); # Test the Close box
-
- selectMenuItem("User", "Use"); # Change to user mode
- wait(4);
- EnterRecord(); # enter some data
-
- selectMenuItem("Design", "Use"); # Back to 'Design' mode
- selectButton("Don't Save");
-
- selectMenuItem("New File", "Structure"); # Create new file
- moveRelativeToWindow(200,100,1,2); # Select place for new file
- LogStr("Created a new file",3);
-
- DoCloseApp(-1);
-
- LogStr("############################# LIMITATIONS: ############################");
- LogStr("NOTE: Do to unique nature of 4D, many standard QL tests can't be done.");
- LogStr('NOTE: Different modes are equivelant to Views() in 4D',2);
- LogStr("NOTE: Can't paste Text from scrapbook in Layout mode without using text tool",2);
- LogStr('NOTE: No DoDraw because 4D disables VU mousedown on tool palette',2);
- LogStr('NOTE: No DoText because individual text boxes must be drawn',2);
- LogStr('NOTE: No Save As... menuitems in 4D',2);
- end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
- SuiteEnd();
- end; # script FourD